home *** CD-ROM | disk | FTP | other *** search
/ Gurewich OLE Controls for Visual Basic 4 / Gurewich OLE Controls for Visual Basic 4.iso / ocxprog / programs / ch09 / map.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-24  |  6.1 KB  |  187 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMap 
  3.    Caption         =   "The Map Program"
  4.    ClientHeight    =   3225
  5.    ClientLeft      =   1665
  6.    ClientTop       =   2055
  7.    ClientWidth     =   4425
  8.    Height          =   3915
  9.    Icon            =   "MAP.frx":0000
  10.    Left            =   1605
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3225
  13.    ScaleWidth      =   4425
  14.    Top             =   1425
  15.    Width           =   4545
  16.    Begin TegomapLibCtl.TegoMap TegoMap1 
  17.       Height          =   3210
  18.       Left            =   0
  19.       TabIndex        =   0
  20.       Top             =   0
  21.       Width           =   4440
  22.       _version        =   65536
  23.       _extentx        =   7832
  24.       _extenty        =   5662
  25.       _stockprops     =   64
  26.       mappicture      =   "MAP.frx":030A
  27.       maskpicture     =   "MAP.frx":7F54
  28.       autosize        =   -1  'True
  29.    End
  30.    Begin VB.Menu mnuFile 
  31.       Caption         =   "&File"
  32.       Begin VB.Menu mnuExit 
  33.          Caption         =   "E&xit"
  34.       End
  35.    End
  36.    Begin VB.Menu mnuSize 
  37.       Caption         =   "&Size"
  38.       Begin VB.Menu mnuNormal 
  39.          Caption         =   "&Normal"
  40.       End
  41.       Begin VB.Menu mnuSmall 
  42.          Caption         =   "&Small"
  43.       End
  44.       Begin VB.Menu mnuLarge 
  45.          Caption         =   "&Large"
  46.       End
  47.    End
  48.    Begin VB.Menu mnuHelp 
  49.       Caption         =   "&Help"
  50.       Begin VB.Menu mnuAbout 
  51.          Caption         =   "About..."
  52.       End
  53.    End
  54. Attribute VB_Name = "frmMap"
  55. Attribute VB_Creatable = False
  56. Attribute VB_Exposed = False
  57. ' All variables must be declared.
  58. Option Explicit
  59. ' Declare variables to hold the default
  60. ' width and height of the form.
  61. Dim gDefaultWidth
  62. Dim gDefaultHeight
  63. Private Sub Form_Load()
  64.    ' Store the default height and width of the form.
  65.    gDefaultHeight = Me.Height
  66.    gDefaultWidth = Me.Width
  67.    ' Specify the total number of regions.
  68.    TegoMap1.NumberOfRegions = 8
  69.    ' Define region #1 (the man's right ear).
  70.    TegoMap1.RegionName(1) = "right ear"
  71.    TegoMap1.RegionColor(1) = QBColor(12) 'Light Red.
  72.    TegoMap1.RegionX1(1) = 0
  73.    TegoMap1.RegionY1(1) = 92
  74.    TegoMap1.RegionX2(1) = 43
  75.    TegoMap1.RegionY2(1) = 136
  76.    ' Define region #2 (the man's left ear).
  77.    TegoMap1.RegionName(2) = "left ear"
  78.    TegoMap1.RegionColor(2) = QBColor(12) 'Light Red.
  79.    TegoMap1.RegionX1(2) = 252
  80.    TegoMap1.RegionY1(2) = 92
  81.    TegoMap1.RegionX2(2) = 295
  82.    TegoMap1.RegionY2(2) = 136
  83.    ' Define region #3 (the man's right eye).
  84.    TegoMap1.RegionName(3) = "right eye"
  85.    TegoMap1.RegionColor(3) = QBColor(12) 'Light Red.
  86.    TegoMap1.RegionX1(3) = 82
  87.    TegoMap1.RegionY1(3) = 90
  88.    TegoMap1.RegionX2(3) = 129
  89.    TegoMap1.RegionY2(3) = 118
  90.    ' Define region #4 (the man's left eye).
  91.    TegoMap1.RegionName(4) = "left eye"
  92.    TegoMap1.RegionColor(4) = QBColor(12) 'Light Red.
  93.    TegoMap1.RegionX1(4) = 166
  94.    TegoMap1.RegionY1(4) = 90
  95.    TegoMap1.RegionX2(4) = 213
  96.    TegoMap1.RegionY2(4) = 118
  97.    ' Define region #5 (the man's nose).
  98.    TegoMap1.RegionName(5) = "nose"
  99.    TegoMap1.RegionColor(5) = QBColor(12) 'Light Red.
  100.    TegoMap1.RegionX1(5) = 140
  101.    TegoMap1.RegionY1(5) = 92
  102.    TegoMap1.RegionX2(5) = 151
  103.    TegoMap1.RegionY2(5) = 148
  104.    ' Define region #6 (the man's mouth).
  105.    TegoMap1.RegionName(6) = "mouth"
  106.    TegoMap1.RegionColor(6) = QBColor(10) 'Light Green.
  107.    TegoMap1.RegionX1(6) = 79
  108.    TegoMap1.RegionY1(6) = 132
  109.    TegoMap1.RegionX2(6) = 220
  110.    TegoMap1.RegionY2(6) = 189
  111.    ' Define region #7 (the man's hair).
  112.    TegoMap1.RegionName(7) = "hair"
  113.    TegoMap1.RegionColor(7) = QBColor(12) 'Light Red.
  114.    TegoMap1.RegionX1(7) = 56
  115.    TegoMap1.RegionY1(7) = 0
  116.    TegoMap1.RegionX2(7) = 273
  117.    TegoMap1.RegionY2(7) = 58
  118.    ' Define region #8 (the man's face).
  119.    TegoMap1.RegionName(8) = "face"
  120.    TegoMap1.RegionColor(8) = QBColor(14) 'Light Yellow.
  121.    TegoMap1.RegionX1(8) = 44
  122.    TegoMap1.RegionY1(8) = 17
  123.    TegoMap1.RegionX2(8) = 251
  124.    TegoMap1.RegionY2(8) = 213
  125. End Sub
  126. Private Sub Form_Resize()
  127.    ' Size the map control to the size of the form.
  128.    TegoMap1.Width = Me.ScaleWidth
  129.    TegoMap1.Height = Me.ScaleHeight
  130. End Sub
  131. Private Sub mnuAbout_Click()
  132.    Dim Title
  133.    Dim Msg
  134.    Dim CR
  135.    CR = Chr(13) + Chr(10)
  136.    ' The title of the About message box.
  137.    Title = "About the Map Program"
  138.    ' Prepare the message of the About message box.
  139.    Msg = "This program was written with Visual "
  140.    Msg = Msg + "Basic for Windows, using the "
  141.    Msg = Msg + "TegoSoft Map OCX control. "
  142.    Msg = Msg + CR + CR
  143.    Msg = Msg + "The TegoSoft Map OCX control "
  144.    Msg = Msg + "is part of the TegoSoft OCX Control "
  145.    Msg = Msg + "Kit - a collection of various OCX controls. "
  146.    Msg = Msg + CR + CR
  147.    Msg = Msg + "For more information about the "
  148.    Msg = Msg + "TegoSoft OCX Control Kit, contact TegoSoft "
  149.    Msg = Msg + "at:"
  150.    Msg = Msg + CR + CR
  151.    Msg = Msg + "TegoSoft Inc." + CR
  152.    Msg = Msg + "P.O. Box 389" + CR
  153.    Msg = Msg + "Bellmore, NY 11710"
  154.    Msg = Msg + CR + CR
  155.    Msg = Msg + "Phone: (516)783-4824"
  156.    ' Display the About message box.
  157.    MsgBox Msg, vbInformation, Title
  158. End Sub
  159. Private Sub mnuExit_Click()
  160.    ' Terminate the program.
  161.    Unload Me
  162. End Sub
  163. Private Sub mnuLarge_Click()
  164.    ' Maximize the form.
  165.    Me.WindowState = 2
  166. End Sub
  167. Private Sub mnuNormal_Click()
  168.    ' Set the WindowState property of the form to Normal.
  169.    Me.WindowState = 0
  170.    ' Set the size of the form to the default size.
  171.    Me.Width = gDefaultWidth
  172.    Me.Height = gDefaultHeight
  173. End Sub
  174. Private Sub mnuSmall_Click()
  175.    ' Set the WindowState property of the form to Normal.
  176.    Me.WindowState = 0
  177.    ' Set the size of the form to one half of the default size.
  178.    Me.Width = gDefaultWidth / 2
  179.    Me.Height = gDefaultHeight / 2
  180. End Sub
  181. Private Sub TegoMap1_ClickMap(ByVal RegionId As Integer)
  182.  ' If a valid region was clicked, display a message box.
  183.  If RegionId <> 0 Then
  184.     MsgBox "You clicked my " + TegoMap1.RegionName(RegionId)
  185.  End If
  186. End Sub
  187.